// types/order.ts
export interface SalesOrder {
  id: string
  platformOrderId: string
  platformSource: 'zcy' | 'manual' | 'other'
  customerName: string
  customerCode?: string
  contactPerson?: string
  amount: number
  orderStatus: 'pending' | 'paid' | 'shipped' | 'completed' | 'cancelled'
  invoiceStatus: 'uninvoiced' | 'invoiced' | 'sent'
  invoiceDate?: string
  orderDate: string
  responsibleSalesman?: string
  hasGift: boolean
  editable: boolean
  createdAt: string
  updatedAt: string
}

export interface OrderQueryParams {
  page: number
  limit: number
  orderStatus?: string
  invoiceStatus?: string
  customerName?: string
  orderDateRange?: string[]
  minAmount?: number
  maxAmount?: number
  platformSource?: string
  responsibleSalesman?: string
  platformOrderId?: string
  includeGifts?: boolean
  sortField?: string
  sortOrder?: 'asc' | 'desc'
}

export interface OrderStats {
  totalOrders: number
  pendingOrders: number
  completedOrders: number
  problemOrders: number
  monthlyAmount: number
  avgOrderAmount: number
  completionRate: number
  uninvoicedOrders: number
  amountTrend: number
  avgTrend: number
  completionTrend: number
  invoiceTrend: number
}

export interface BatchOperation {
  type: 'export' | 'invoice' | 'status'
  orders: string[]
  params?: any
}